<template lang="pug">
    keep-alive
        kalix-table(bizKey="enrolmentScoreStander" v-bind:title="title" v-bind:targetURL="targetURL"
        v-bind:bizDialog="bizDialog" v-bind:isFixedColumn="isFixedColumn" v-bind:dialogOptions="dialogOptions"
        v-bind:toolbarBtnList="toolbarBtnList"
        v-bind:btnList="btnList" ref="scoreStanderTable")
            template(slot="tableColumnSlot")
                el-table-column(prop="standerItem" label="标准项" align="center" )
                el-table-column(prop="itemScore" label="分数" align="center" )
                el-table-column(prop="propositionTeacher" label="命题人" align="center" )
</template>

<script type="text/ecmascript-6">
    import {ScoreStandardBtnList} from './config.js'

    export default {
        name: 'kalix-enrolment-scorestander',
        props: {
            subType: {
                type: String
            },
            quesId: {
                type: Number,
                default: -1
            },
            title: {
                type: String,
                default: ''
            }
        },
        data() {
            return {
                bizDialog: [
                    {id: 'view', dialog: 'ScoreStanderView'},
                    {id: 'edit', dialog: 'ScoreStanderEdit'},
                    {id: 'add', dialog: 'ScoreStanderAdd'}
                ],
                isFixedColumn: true,
                btnList: ScoreStandardBtnList,
                targetURL: "/camel/rest/subjects/" + this.quesId + "/scorestanders",
                dialogOptions: {},
                addBtnDisabled: true
            }
        },
        watch: {
            quesId(newValue) {
                this.dialogOptions = {
                    subType: this.subType,
                    quesId: newValue
                }
                if (newValue != -1) {
                    this.addBtnDisabled = false
                } else {
                    this.addBtnDisabled = true
                }
                this.targetURL = "/camel/rest/subjects/" + newValue + "/scorestanders"
            }
        },
        computed: {
            toolbarBtnList() {
                return [
                    {id: 'add', isShow: true, type: 'default', isDisable: this.addBtnDisabled}
                ]
            }
        }
    }
</script>

<style scoped>

</style>